Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

129
Visualizações
using a WooCommerce,i wanted the product attribute "color section" to be hidden/disable when a customer clicked "stock" in product price and idk how

function hideStock(){
        var selected = document.getElementById("stk");
        var hidden = document.getElementById("pa_color");
        if (selected.onchange=="stock") {
                hidden.style.display = "none";
        }
}
<table class="variations" cellspacing="0">
  <tbody>
        <tr>
        <td class="label"><label for="pa_pricing">Pricing</label></td>
        <td class="value">
    <select id="pa_pricing" class="" name="attribute_pa_pricing" data-attribute_name="attribute_pa_pricing" data-show_option_none="yes" onchange= "getSelectValue(this.value);">
      <option value="">Choose an option</option>
      <option value="retail" >Retail</option>
      <option value="stock" id = "stk" >Stock</option>
    </select>                       
          </td>
            </tr>
            <tr>
            <td class="label"><label for="pa_color">Color</label></td>
                        <td class="value">
        <select id="pa_color" class=" " name="attribute_pa_color" data-attribute_name="attribute_pa_color" data-show_option_none="yes">
            <option value=""  >Choose an option</option>
            <option value="aqua"  >Aqua</option>
            <option value="black"  >Black</option>
            <option value="mixed"  >Mixed</option>

        </select>
                <a class="reset_variations" href="#">Clear</a>
            </td>
            </tr>
    </tbody>
</table>
this html code is a small portion from woocommerce shop that im doing right now and it has product attribute one is for price (Retail , Stock ) another is for Color

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

try it:

var selected = document.getElementById("stk");
var hidden = document.getElementById("pa_color");
selected.addEventListener('change', _ => {
    if (selected.value == "stock") {
        hidden.style.display = "none";
    }
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda